%% test script
%
%%
clear all
clc
%%
X=(1:0.5:10.5);
Y=sin(X);
sz=size(X);
row = 5;
col = 4;
A=reshape(Y,row,col)

Mn=A-repmat(mean(A,2),1,col)

[U,S,V]=svd(Mn)

B=zeros(row,col);

sumSi=0;
SumS=sum(sum(S))
for i=1:size(S,1)

	sumSi=S(i,i)+sumSi;	
	if sumSi > 0.9*SumS
                break;
        end
end
diagnum=i
for i=1:diagnum

	B=S(i,i)*U(:,i)*V(:,i)'+B;

end
B
